$OpenBSD: patch-SConstruct,v 1.5 2015/07/01 08:45:19 jasper Exp $
--- SConstruct.orig	Tue Jun  4 03:35:26 2013
+++ SConstruct	Mon Jun 29 09:15:50 2015
@@ -273,7 +273,7 @@ opts.AddVariables(
     ('CUSTOM_LDFLAGS', 'Custom linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>', ''),
     EnumVariable('LINKING', "Set library format for libmapnik",'shared', ['shared','static']),
     EnumVariable('RUNTIME_LINK', "Set preference for linking dependencies",'shared', ['shared','static']),
-    EnumVariable('OPTIMIZATION','Set compiler optimization level','3', ['0','1','2','3','4','s']),
+    EnumVariable('OPTIMIZATION','Set compiler optimization level','2', ['0','1','2','3','4','s']),
     # Note: setting DEBUG=True will override any custom OPTIMIZATION level
     BoolVariable('DEBUG', 'Compile a debug version of Mapnik', 'False'),
     BoolVariable('DEBUG_UNDEFINED', 'Compile a version of Mapnik using clang/llvm undefined behavior asserts', 'False'),
@@ -1122,6 +1122,12 @@ if not preconfigured:
         thread_suffix = ''
         env.Append(LIBS = 'pthread')
 
+    if env['PLATFORM'] == 'OpenBSD':
+        thread_suffix = '-mt'
+        env.Append(LIBS = 'pthread')
+        env.Append(LINKFLAGS = ['-lstdc++'])
+        env.Append(CPPDEFINES = '-DBOOST_SPIRIT_USE_PHOENIX_V3=1')
+
     # Solaris & Sun Studio settings (the `SUNCC` flag will only be
     # set if the `CXX` option begins with `CC`)
     SOLARIS = env['PLATFORM'] == 'SunOS'
@@ -1277,6 +1283,9 @@ if not preconfigured:
             # of attaching to cxxflags after configure
             if env['PLATFORM'] == 'SunOS':
                 env.Append(CXXFLAGS = '-pthreads')
+            if env['PLATFORM'] == 'OpenBSD':
+                env.Append(CXXFLAGS = '-pthread')
+
 
         # if requested, sort LIBPATH and CPPPATH before running CheckLibWithHeader tests
         if env['PRIORITIZE_LINKING']:
